
Introduction to Servlets
Documentation /
Developer Docs /
Administrator Docs /
Index
This document introduces the basics about servlets:
Servlets provide a Java-based solution used to address the problems
currently associated with doing server-side programming, including
inextensible scripting solutions, platform-specific APIs, and
incomplete interfaces.
Servlets are objects that conform to a specific interface that can be
plugged into a Java-based server. Servlets are to the server-side what
applets are to the client-side - object bytecodes that can be dynamically
loaded off the net. They differ from applets in that they are faceless
objects (without graphics or a GUI component). They serve as platform
independent, dynamically loadable, pluggable helper bytecode objects on
the server side that can be used to dynamically extend server-side
functionality.
For example, an HTTP servlet can be used to generate dynamic HTML content.
When you use servlets to do dynamic content you get the following
advantages:
- they're faster and cleaner than CGI scripts
- they use a standard API (the Servlet API)
- they provide all the advantages of Java (run on a variety of servers
without needing to be rewritten)
There are many features of servlets that make them easy and attractive
to use. These include:
- easily configured using the GUI-based
Admin Tool.
- can be loaded and invoked from a local disk
or remotely across the network.
- can be linked together, or chained, so
that one servlet can call another servlet, or several servlets in sequence.
- can be called dynamically from within HTML pages, using
server-side include tags.
- are secure - even when downloading across the network, the
servlet security model and servlet sandbox protect your system from
unfriendly behavior.
(NOTE: Security in the JavaServer is provided by combining the
code-signing facility of JDK 1.1 and the Access Control List implementation
of the Server Toolkit. This allows servlet classes, or servlet JAR files, to
be signed. The signers are then assigned permissions in an access control
list. For more information on servlet security, see
Security Administration for JavaServer).
One of the great advantages of the Servlet API is
protocol independence. It assumes nothing about:
- the protocol being used to transmit on the net
- how it is loaded
- the server environment it will be running in
These qualities are important, because it allows the Servlet API to be
embedded in many different kinds of servers. There are other advantages
to the Servlet API as well. These include:
- it's extensible - you can inherit all your functionality from the
base classes made available to you.
- it's simple, small, and easy to use
Top
java-server-feedback@java.sun.com